package com.ch.home.testMapper;

import com.ch.home.bean.GameRepository;
import com.ch.home.mapper.gameMapper.GameRepositoryMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.ArrayList;

/**
 * Created by CHEN on 2019/8/29.
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class testGameRepositoryMapper {

    @Autowired
    GameRepositoryMapper gameRepositoryMapper;

    //    Integer addQuestion(GameRepository gameRepository);
    @Test
    public void testAddquestion() {
        GameRepository gameRepository = new GameRepository(null, null, "请问番茄炒蛋里面有什么", "西红柿", "土豆", "西红柿");
        Integer integer = gameRepositoryMapper.addQuestion(gameRepository);
        System.out.println(integer);
        System.out.println("------------------------------");
        System.out.println(gameRepository);
    }

    //Integer addMulQuestion(ArrayList<GameRepository> list);
    @Test
    public void testAddMulQuestion() {
        GameRepository gameRepository = new GameRepository(null, null, "请问黄焖鸡米饭里面有什么", "西红柿", "鸡肉", "鸡肉");
        GameRepository gameRepository1 = new GameRepository(null, null, "请问糖醋排骨为什么又酸又甜", "有糖也有醋", "施了魔法", "有糖也有醋");

        ArrayList<GameRepository> list = new ArrayList<>( );
        list.add(gameRepository);
        list.add(gameRepository1);
        Integer integer = gameRepositoryMapper.addMulQuestion(list);
        System.out.println(integer);


    }
//    ArrayList<Integer> getAllQuestionId();

    @Test
    public void testGetAllquestionId() {

        ArrayList<Integer> allQuestionId = gameRepositoryMapper.getAllQuestionId( );
        System.out.println(allQuestionId);
    }


//    Integer updateQuestion(GameRepository gameRepository);


    @Test
    public void testUpdateQuestion(){
        Integer integer = gameRepositoryMapper.updateQuestion(new GameRepository(2, "http://www.baidu.com", "请问黄焖鸡米饭是哪个地方的美食", "济南", "合肥", "济南"));
        System.out.println(integer );
    }
}
